package com.etc.service;

import com.etc.dao.ViewEngageDao;
import com.etc.entity.ViewEngageInfo;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ViewEngageServiceImpl implements ViewEngageService {

    @Autowired
    ViewEngageDao dao;

    /**
     * 查询所有订单
     * @return
     */
    @Override
    public PageInfo<ViewEngageInfo> getAllEngage(int pageNum, int pageSize) {
        //1.开始分页
        PageHelper.startPage(pageNum, pageSize);
        //2.执行查询所有用户信息
        List<ViewEngageInfo> list = dao.queryAllEngage();
        //3.通过pageInfo进行包装,PageInfo包含了非常丰富的分页属性
        PageInfo<ViewEngageInfo> pageInfo = new PageInfo<ViewEngageInfo>(list);
        return pageInfo;
    }

    /**
     * 根据订单编号修改状态
     * @param eId
     * @return
     */
    @Override
    public boolean updateStatus(int s,int eId) {
        int n=dao.upegstatus(s,eId);
        return n>0;
    }
}
